home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / PowerMacOberon 1.2 / Debugger / Debug.Mod (.txt) < prev    next >
Encoding:
Oberon Text  |  1995-08-22  |  18.8 KB  |  503 lines  |  [TEXT/.Ob4]

  1. Syntax10.Scn.Fnt
  2. StampElems
  3. Alloc
  4. 22 Aug 95
  5. InfoElems
  6. Alloc
  7. Syntax10.Scn.Fnt
  8. StampElems
  9. Alloc
  10. 22 Aug 95
  11. "Title": Run time debugger
  12. "Author": mah
  13. "Abstract": command module
  14. "Keywords": 
  15. "Version": 
  16. "From":  25.10.94 16:53:38
  17. "Until": 
  18. "Changes": 
  19. ParcElems
  20. Alloc
  21. Syntax10i.Scn.Fnt
  22. FoldElems
  23. Syntax10.Scn.Fnt
  24. Syntax10i.Scn.Fnt
  25.         mod: Modules.Module;            (* current module *)
  26.         pc: LONGINT;                    (* current pc *)
  27.     END;
  28. Syntax10.Scn.Fnt
  29.     END;
  30. Syntax10.Scn.Fnt
  31. Syntax10i.Scn.Fnt
  32.         pos: LONGINT;                    (* new position in text of PC *)
  33.         name: ARRAY 32 OF CHAR;        (* name of file of module *)
  34.         done: BOOLEAN;                (* TRUE -> pc somewhere set *)
  35.     END;
  36. Syntax10.Scn.Fnt
  37.         base: LONGINT;
  38.         syms: RTDC.Sym;
  39.         regs: Sys.ExceptionInfo;
  40.         modName: ARRAY 32 OF CHAR;
  41.     END;
  42. Syntax10.Scn.Fnt
  43. VAR win: ARRAY 3 OF CHAR; level: INTEGER;
  44. BEGIN
  45.     level := 1; Texts.Read (s, win[0]); Texts.Read (s, win[1]); win[2] := 0X;
  46.     REPEAT
  47.         IF win = "(*" THEN INC (level)
  48.         ELSIF win = "*)" THEN DEC (level) END;
  49.         win[0] := win[1]; Texts.Read (s, win[1])
  50.     UNTIL level = 0
  51. END SkipComment;
  52. Syntax10.Scn.Fnt
  53. VAR found : BOOLEAN;
  54. BEGIN
  55.     REPEAT
  56.         Texts.Scan (s);
  57.         found := TRUE;
  58.         WHILE (s.class=Texts.Char) & (s.c=CHR (28)) DO found := FALSE; Texts.Scan (s) END;    (* skip text elements *)
  59.         IF (s.class=Texts.Char) & (s.c='(') THEN 
  60.             Texts.Scan (s);
  61.             IF (s.class=Texts.Char) & (s.c='*') THEN found := FALSE; SkipComment (s) ELSE RETURN END
  62.         END
  63.     UNTIL found;
  64. END Token;
  65. Syntax10.Scn.Fnt
  66. VAR s: Texts.Scanner; set: SET; a: ARRAY 32 OF CHAR;
  67. BEGIN
  68.     Texts.OpenScanner (s, t, pos);
  69.     REPEAT Token (s) UNTIL (s.class#Texts.Char) OR (s.c#';');        
  70.     IF s.class # Texts.Name THEN RETURN END;
  71.     IF ((s.s = "END") OR (s.s = "ELSE") OR (s.s = "ELSIF")) THEN pos := Texts.Pos (s)-1 END
  72. END NextToken;
  73. Syntax10.Scn.Fnt
  74.     VAR p: TextFrames.Parc; beg: LONGINT;
  75. BEGIN
  76.     IF f = NIL THEN
  77.         IF fnt = NIL THEN dsr := 0 ELSE dsr := - fnt.minY END
  78.     ELSE
  79.         TextFrames.ParcBefore(f(TextFrames.Frame).text, pos, p, beg);
  80.         dsr := SHORT(p.dsr DIV TextFrames.Unit)
  81. END GetDsr;
  82. Syntax10.Scn.Fnt
  83. VAR end, delta: LONGINT;
  84. BEGIN
  85.     delta := 200;
  86.     LOOP end := TextFrames.Pos(f, f.X + f.W, f.Y);
  87.         IF (f.org <= pos) & (pos < end) OR (f.org = end) THEN EXIT END;
  88.         TextFrames.Show (f, pos - delta); DEC(delta, 20)
  89. END Show;
  90. Syntax10.Scn.Fnt
  91. VAR dsr: INTEGER; new: PCElem;
  92. BEGIN
  93.     WITH e: PCElem DO
  94.         WITH msg : TextFrames.DisplayMsg DO
  95.             IF ~ msg.prepare THEN
  96.                 GetDsr (msg.frame, msg.pos, msg.fnt, dsr);
  97.                 Display.CopyPattern(Display.white, iconPC, msg.X0, msg.Y0 + dsr, Display.paint)
  98.             END
  99.         |    msg : Texts.CopyMsg DO
  100.             NEW (new); Texts.CopyElem (e, new); msg.e := new
  101.         ELSE
  102.         END
  103. END PCElemHandle;
  104. Syntax10.Scn.Fnt
  105. VAR dsr: INTEGER; new: BPElem;
  106. BEGIN
  107.     WITH e: BPElem DO
  108.         WITH msg : TextFrames.DisplayMsg DO
  109.             IF ~ msg.prepare THEN
  110.                 GetDsr (msg.frame, msg.pos, msg.fnt, dsr);
  111.                 Display.CopyPattern(Display.white, iconBP, msg.X0, msg.Y0 + dsr, Display.paint)
  112.             END
  113.         |    msg : Texts.CopyMsg DO
  114.             NEW (new); Texts.CopyElem(e, new); msg.e := new
  115.         ELSE
  116.         END
  117. END BPElemHandle;
  118. Syntax10.Scn.Fnt
  119. VAR new: PCElem;
  120. BEGIN
  121.     NEW (new); new.handle := PCElemHandle;
  122.     new.W := 13 * TextFrames.Unit; new.H := 9 * TextFrames.Unit;
  123.     new.mod := mod; new.pc := pc;
  124.     RETURN new
  125. END AllocPCElem;
  126. Syntax10.Scn.Fnt
  127. VAR text: Texts.Text; beg, end, time: LONGINT;
  128. BEGIN 
  129.     Texts.OpenScanner(s, Oberon.Par.text, Oberon.Par.pos); Texts.Scan (s);
  130.     IF ((s.class = Texts.Char) & (s.c = "^")) OR (Oberon.Par.frame = Oberon.Par.vwr.dsc) THEN 
  131.         Oberon.GetSelection(text, beg, end, time);
  132.         IF time >= 0 THEN Texts.OpenScanner(s, text, beg); Texts.Scan(s) END;
  133.         Oberon.Par.text := text;
  134.         Oberon.Par.pos := Texts.Pos (s)
  135.     ELSE Oberon.Par.pos := Texts.Pos (s) END
  136. END GetArg;
  137. Syntax10.Scn.Fnt
  138. VAR v: Viewers.Viewer; s: Texts.Scanner; r: Texts.Reader; pos, startPos: LONGINT; newpc: PCElem; i: INTEGER;
  139. BEGIN
  140.     WITH f: TextFrames.Frame DO
  141.         WITH msg: SetPCMsg DO
  142.             startPos := msg.pos; pos := startPos; Texts.OpenReader (r, f.text, 0); Texts.ReadElem(r);
  143.             WHILE ~ r.eot & ~ (r.elem IS PCElem) DO
  144.                 IF r.elem IS BPElem THEN INC (msg.pos) END;
  145.                 Texts.ReadElem (r)
  146.             END;
  147.             IF ~ r.eot THEN pos := Texts.ElemPos (r.elem); Texts.Delete (f.text, pos, pos+1) END;
  148.             v := Viewers.This (f.X, f.Y);
  149.             Texts.OpenScanner(s, v.dsc(TextFrames.Frame).text, 0); Texts.Scan(s);
  150.             IF (msg.name = s.s) & (startPos >= 0) THEN
  151.                 newpc := AllocPCElem (Modules.ThisMod (msg.name), RTDT.PC ());
  152.                 Texts.WriteElem (w, newpc);
  153.                 NextToken (f.text, msg.pos);
  154.                 Texts.Insert (f.text, msg.pos, w.buf);
  155.                 Show (f, msg.pos + 1);
  156.                 lastPos := pos; lastBeginPC := RTDT.procs.beginPC; msg.done := TRUE
  157.             END
  158.         | msg: RTDB.GetBPMsg DO
  159.             Texts.OpenReader (r, f.text, 0); Texts.ReadElem (r);
  160.             WHILE ~ r.eot DO
  161.                 IF r.elem IS BPElem THEN
  162.                     v := Viewers.This (f.X, f.Y);
  163.                     Texts.OpenScanner(s, v.dsc(TextFrames.Frame).text, 0); Texts.Scan(s);
  164.                     i := 0; WHILE (s.s[i] # 0X) & (s.s[i] # '.') DO INC (i) END; s.s[i] := 0X;
  165.                     IF ~ RTDB.BreakAtPC (s.s, Texts.ElemPos (r.elem)) THEN
  166.                         Texts.WriteString (w, s.s); Texts.WriteString (w, ": Illegal breakpoint pos ");
  167.                         Texts.WriteInt (w, Texts.ElemPos (r.elem), 0); Texts.WriteLn (w);
  168.                         Texts.Append (Oberon.Log, w.buf)
  169.                     END
  170.                 END;
  171.                 Texts.ReadElem (r)
  172.             END
  173.         ELSE PrevFrameHandle (f, msg) END
  174. END FrameHandle;
  175. Syntax10.Scn.Fnt
  176. Syntax10i.Scn.Fnt
  177. VAR msg: SetPCMsg; x, y, i: INTEGER; v: Viewers.Viewer; f, f2: TextFrames.Frame; t: Texts.Text; pc: LONGINT;
  178. BEGIN
  179.     pc := RTDT.PC (); RTDB.PCToPos (pc, msg.name, msg.pos);
  180.     IF ~RTDT.Debugging () THEN msg.pos := -1 END;
  181.     i := 0; WHILE msg.name[i] # 0X DO INC (i) END;
  182.     msg.name[i] := '.'; msg.name[i+1] := 'M'; msg.name[i+2] := 'o'; msg.name[i+3] := 'd'; msg.name[i+4] := CHR(0);
  183.     msg.done := FALSE;
  184.     Viewers.Broadcast (msg);
  185.     IF ~msg.done & RTDT.Debugging () THEN                         (* text not shown -> open a new one *)
  186.         Oberon.AllocateUserViewer (0, x, y);
  187.         t := TextFrames.Text (msg.name);
  188.         FoldElems.ExpandAll (t, 0, TRUE);
  189.         v := MenuViewers.New (TextFrames.NewMenu (msg.name, "^Edit.Menu.Text"),
  190.             TextFrames.NewText (t, msg.pos-100), TextFrames.menuH, x, y);
  191.         v.handle (v, msg);
  192. END PCHandler;
  193. Syntax10.Scn.Fnt
  194. VAR msg: SetPCMsg;
  195. BEGIN msg.pos := -1; Viewers.Broadcast (msg)
  196. END PCOffHandler;
  197. Syntax10.Scn.Fnt
  198. VAR t: Text;
  199. BEGIN
  200.     NEW (t); Texts.Open (t, ""); t.notify := TextFrames.NotifyDisplay;
  201.     t.base := base; t.syms := syms; t.regs := regs; COPY (modName, t.modName);
  202.     RETURN t
  203. END NewText;
  204. Syntax10.Scn.Fnt
  205. VAR msg: UpdateDataMsg;
  206. BEGIN Viewers.Broadcast (msg)
  207. END DataHandler;
  208. Syntax10b.Scn.Fnt
  209. Syntax10.Scn.Fnt
  210. VAR dummy: ARRAY RTDT.StackSize OF LONGINT;
  211. BEGIN IF RTDT.Debugging () THEN RTDB.StepAll; HALT (RTDT.EnterDebugMode) END
  212. END StepInto;
  213. Syntax10.Scn.Fnt
  214. VAR dummy: ARRAY RTDT.StackSize OF LONGINT;
  215. BEGIN IF RTDT.Debugging () THEN RTDB.StepOverAll; HALT (RTDT.EnterDebugMode) END
  216. END Step;
  217. Syntax10.Scn.Fnt
  218. VAR dummy: ARRAY RTDT.StackSize OF LONGINT;
  219. BEGIN IF RTDT.Debugging () THEN RTDT.PopProc; RTDB.StepOverAll; HALT (RTDT.EnterDebugMode) END
  220. END Return;
  221. Syntax10.Scn.Fnt
  222. VAR dummy: ARRAY RTDT.StackSize OF LONGINT;
  223. BEGIN IF RTDT.Debugging () THEN RTDB.BreakAll; HALT (RTDT.EnterDebugMode) END
  224. END Run;
  225. Syntax10.Scn.Fnt
  226. BEGIN RTDT.Install
  227. END PostMortem;
  228. Syntax10.Scn.Fnt
  229. VAR m: RTDB.ModuleInfo;
  230. BEGIN
  231.     m := RTDB.modules;
  232.     WHILE m # NIL DO Texts.WriteString (w, m.name); Texts.WriteLn (w); m := m.next END;
  233.     Texts.Append (Oberon.Log, w.buf)
  234. END ShowModules;
  235. Syntax10.Scn.Fnt
  236. VAR v: Viewers.Viewer; x, y: INTEGER; p: RTDT.Proc; t: Texts.Text;
  237. BEGIN
  238.     p := RTDT.procs;
  239.     WHILE p # NIL DO
  240.         Texts.WriteString (w, p.modName); Texts.Write (w, '.'); Texts.WriteString (w, p.name);
  241.         Texts.WriteLn (w);
  242.         p := p.up
  243.     END;
  244.     t := TextFrames.Text (""); Texts.Append (t, w.buf);
  245.     Oberon.AllocateSystemViewer (0, x, y);
  246.     v := MenuViewers.New (
  247.         TextFrames.NewMenu ("RTD.Stack", "System.Close RTD.Data RTD.Source "),
  248.         TextFrames.NewText (t, 0),
  249.         TextFrames.menuH,
  250.         x, y)    
  251. END Stack;
  252. Syntax10.Scn.Fnt
  253.     proc: RTDT.Proc;
  254.     i, off, x, y: INTEGER;
  255.     name, modName, procName: ARRAY 64 OF CHAR;
  256.     s: Texts.Scanner;
  257.     pos: LONGINT;
  258.     t: Texts.Text;
  259.     v: Viewers.Viewer;
  260. BEGIN
  261.     GetArg (s); 
  262.     IF s.class # Texts.Name THEN RETURN END;
  263.     COPY (s.s, name); i := 0;
  264.     WHILE (name[i] # '.') & (name[i] # CHR (0)) DO modName[i] := name[i]; INC (i) END;
  265.     modName[i] := CHR (0);
  266.     IF name[i] = '.' THEN
  267.         off:=0; INC (i);
  268.         WHILE name[i+off] # CHR (0) DO procName[off] := name[i + off]; INC (off) END; procName[off] := CHR (0);
  269.         proc := RTDT.procs;
  270.         WHILE (proc # NIL) & ((proc.name # procName) OR (proc.modName # modName)) DO proc := proc.up END;
  271.         IF proc # NIL THEN
  272.             RTDB.PCToPos (proc.pc, name, pos);
  273.             i := 0; WHILE modName[i] # 0X DO INC (i) END;
  274.             modName[i] := '.'; modName[i+1] := 'M'; modName[i+2] := 'o'; modName[i+3] := 'd'; modName[i+4] := CHR(0);
  275.             Oberon.AllocateUserViewer (0, x, y);
  276.             t := TextFrames.Text (modName);
  277.             FoldElems.ExpandAll (t, 0, TRUE);
  278.             v := MenuViewers.New (TextFrames.NewMenu (modName, "^Edit.Menu.Text"),
  279.                 TextFrames.NewText (t, pos-100), TextFrames.menuH, x, y);
  280.             TextFrames.SetCaret (v.dsc.next(TextFrames.Frame), pos)    
  281.         END
  282. END Source;
  283. Syntax10.Scn.Fnt
  284. VAR e: BPElem; m: TextFrames.InsertElemMsg; f: Display.Frame; h: Display.Handler; 
  285. BEGIN
  286.     NEW (e); m.e := e;
  287.     e.W := 13 * TextFrames.Unit; e.H := 9 * TextFrames.Unit;
  288.     e.handle := BPElemHandle;
  289.     Oberon.FocusViewer.handle(Oberon.FocusViewer, m)
  290. END Breakpoint;
  291. Syntax10.Scn.Fnt
  292. Syntax10i.Scn.Fnt
  293.     i, off, x, y: INTEGER;
  294.     name, modName, procName: ARRAY 64 OF CHAR;
  295.     s: Texts.Scanner;
  296.     mod: Modules.Module;
  297.     v: Viewers.Viewer;
  298.     f: TextFrames.Frame;
  299.     syms: RTDC.Sym;
  300.     proc: RTDT.Proc;
  301.     t: Text;
  302. BEGIN
  303.     GetArg (s); 
  304.     IF s.class # Texts.Name THEN RETURN END;
  305.     COPY (s.s, name); i := 0;
  306.     WHILE (name[i] # '.') & (name[i] # CHR (0)) DO modName[i] := name[i]; INC (i) END;
  307.     modName[i] := CHR (0);
  308.     IF name[i]#'.' THEN 
  309.         RTDC.Symbols (modName, syms);
  310.         IF syms = NIL THEN
  311.             Texts.WriteString (w, modName); Texts.WriteString (w, " not compilable");
  312.             Texts.WriteLn (w); Texts.Append (Oberon.Log, w.buf);
  313.             RETURN
  314.         END;
  315.         mod := Modules.ThisMod (modName);
  316.         RTDD.GetScope (w, NIL, syms, mod.SB, 0);
  317.         t := NewText (syms, mod.SB, NIL, modName)
  318.     ELSE                                    (* procedure *)
  319.         off:=0; INC (i);
  320.         WHILE name[i+off] # CHR (0) DO procName[off] := name[i + off]; INC (off) END; procName[off] := CHR (0);
  321.         proc := RTDT.procs;
  322.         WHILE (proc # NIL) & ((proc.name # procName) OR (proc.modName # modName)) DO proc := proc.up END;
  323.         IF proc = NIL THEN
  324.             Texts.WriteString (w, name); Texts.WriteString (w, " not on stack"); 
  325.             Texts.WriteLn (w); Texts.Append (Oberon.Log, w.buf);
  326.             RETURN
  327.         END;
  328.         syms := RTDC.FindProc (proc);
  329.         RTDD.GetLocalScope (w, NIL, syms, proc.regs, 0);
  330.         t := NewText (syms, 0, proc.regs, modName)
  331.     END;
  332.     Oberon.AllocateUserViewer (0, x, y);
  333.     f := TextFrames.NewText (t, 0);
  334.     Texts.Append (f.text, w.buf);
  335.     v := MenuViewers.New (TextFrames.NewMenu (name, "^Edit.Menu.Text"), f, TextFrames.menuH, x, y)
  336. END Data;
  337. Syntax10.Scn.Fnt
  338.     VAR line: ARRAY 10 OF SET;
  339. BEGIN
  340.     line[1] := {3..9};
  341.     line[2] := {1..11};
  342.     line[3] := {0, 1, 3..7, 11, 12};
  343.     line[4] := {0, 1, 3..6, 8..12};
  344.     line[5] := {0, 1, 5, 6, 8..12};
  345.     line[6] := {0, 1, 3, 4, 6, 8..12};
  346.     line[7] := {0, 1, 5..7, 11, 12};
  347.     line[8] := {1..11};
  348.     line[9] := {3..9};
  349.     iconPC := Display.NewPattern(line, 13, 9);
  350.     line[1] := {3..9};
  351.     line[2] := {1..11};
  352.     line[3] := {0, 1, 5, 6, 8..12};
  353.     line[4] := {0, 1, 3, 4, 6, 8..12};
  354.     line[5] := {0, 1, 5, 6, 10..12};
  355.     line[6] := {0, 1, 3, 4, 6, 8, 9, 11, 12};
  356.     line[7] := {0, 1, 5, 6, 10..12};
  357.     line[8] := {1..11};
  358.     line[9] := {3..9};
  359.     iconBP := Display.NewPattern(line, 13, 9);
  360. END InitIcon;
  361. Syntax10.Scn.Fnt
  362.     Texts.OpenWriter (w); 
  363.     InitIcon;
  364.     RTDT.debugQ.Add (PCHandler);
  365.     RTDT.debugQ.Add (DataHandler);
  366.     RTDT.startQ.Add (PCOffHandler);
  367.     HandlerElems.ResetHandlers;                    (******************  only temporary *******)
  368.     HandlerElems.SetHandler ("PC control", FrameHandle, PrevFrameHandle);
  369.     HandlerElems.SetHandler ("Data control", DataHandle, PrevDataHandle);
  370.     Texts.WriteString (w, "Debugger mah 11.4.95"); Texts.WriteLn (w); Texts.Append (Oberon.Log, w.buf)
  371. Syntax10.Scn.Fnt
  372.     name: ARRAY 32 OF CHAR;
  373.     i, j: INTEGER;
  374.     mod: Modules.Module;
  375.     cmd: Modules.Command;
  376.     s: Texts.Scanner;
  377.     sb, pc: LONGINT;
  378. BEGIN
  379.     IF ~RTDT.Debugging () THEN
  380.         GetArg (s); 
  381.         IF s.class = Texts.Name THEN
  382.             COPY (s.s, name);
  383.             i := 0; j := 0;
  384.             WHILE name[j] # 0X DO 
  385.                 IF name[j] = "." THEN i := j END;
  386.                 INC(j)
  387.             END;
  388.             IF i > 0 THEN
  389.                 name[i] := 0X;    
  390.                 mod := Modules.ThisMod (name);
  391.                 IF mod # NIL THEN
  392.                     INC (i); j := i;
  393.                     WHILE name[j] # 0X DO name[j-i] := name[j]; INC (j) END;
  394.                     name[j-i] := 0X; cmd := Modules.ThisCommand (mod, name);
  395.                     IF cmd # NIL THEN
  396.                         SYS.GET (SYS.ADR (cmd), pc);
  397.                         SYS.GET (SYS.ADR (cmd)+4, sb);
  398.                         lastpos := 0; RTDT.Install; RTDT.Prepare (pc, sb);
  399.                         RTDB.StepAll; HALT (RTDT.EnterDebugMode)
  400.                     ELSE
  401.                         Texts.WriteString (w, "Command not found: "); Texts.WriteString (w, name);
  402.                         Texts.WriteLn (w); Texts.Append (Oberon.Log, w.buf)
  403.                     END
  404.                 ELSE
  405.                     Texts.WriteString (w, "Module not found: "); Texts.WriteString (w, name);
  406.                     Texts.WriteLn (w); Texts.Append (Oberon.Log, w.buf)
  407.                 END
  408.             END
  409.         END
  410. END Start;
  411. Syntax10.Scn.Fnt
  412. BEGIN IF RTDT.Debugging () THEN RTDB.RestoreAll; RTDT.Stop; RTDC.Release END
  413. END Stop;
  414. MODULE Debug; (* Run time debugger: Commands; mah 25.10.94 (
  415. IMPORT    RTDB, RTDT, RTDC, RTDD, Modules, Texts, Oberon, SYS := SYSTEM, Sys, HandlerElems,
  416.             Viewers, MenuViewers, TextFrames, Display, Fonts, FoldElems, System,
  417. CONST
  418.     InfoMenu = "System.Close System.Grow RTD.Data";       (* system track *)
  419.     PCElem = POINTER TO PCElemDesc;
  420.     BPElem = POINTER TO BPElemDesc;
  421.     PCElemDesc = RECORD (Texts.ElemDesc)
  422.     BPElemDesc = RECORD (Texts.ElemDesc)
  423.     SetPCMsg = RECORD (Display.FrameMsg)
  424.     UpdateDataMsg = RECORD (Display.FrameMsg) END;
  425.     Text = POINTER TO TextDesc;
  426.     TextDesc = RECORD (Texts.TextDesc)
  427.     w: Texts.Writer;
  428.     iconPC, iconBP: Display.Pattern;    (* x = 0, y = -curfnt.minY, w = 13, h = 9 *)
  429.     lastPos: LONGINT;                (* latest text position of PC *)
  430.     lastBeginPC: LONGINT;            (* start PC of latest procedure on stack *)
  431.     PrevFrameHandle, PrevDataHandle: Display.Handler;
  432. PROCEDURE SkipComment (VAR s: Texts.Scanner);
  433. PROCEDURE Token (VAR s: Texts.Scanner);
  434. PROCEDURE NextToken (t: Texts.Text; VAR pos: LONGINT);
  435. PROCEDURE GetDsr (f: Display.Frame; pos: LONGINT; fnt: Fonts.Font; VAR dsr: INTEGER);
  436. PROCEDURE Show (f: TextFrames.Frame; pos: LONGINT);
  437. PROCEDURE PCElemHandle (e: Texts.Elem; VAR msg: Texts.ElemMsg);
  438. PROCEDURE BPElemHandle (e: Texts.Elem; VAR msg: Texts.ElemMsg);
  439. PROCEDURE AllocPCElem (mod: Modules.Module; pc: LONGINT) : PCElem;
  440. PROCEDURE GetArg (VAR s: Texts.Scanner);
  441. PROCEDURE FrameHandle (f: Display.Frame; VAR msg: Display.FrameMsg);
  442. PROCEDURE DataHandle (f: Display.Frame; VAR msg: Display.FrameMsg);
  443. VAR t: Text; mod: Modules.Module; ok: BOOLEAN; p: RTDT.Proc; org: LONGINT;
  444. BEGIN
  445.     WITH f: TextFrames.Frame DO
  446.         WITH msg: UpdateDataMsg DO
  447.             IF f.text IS Text THEN
  448.                 t := f.text(Text);
  449.                 IF t.regs = NIL THEN                                         (* global scope *)
  450.                     mod := Modules.ThisMod (t.modName);
  451.                     IF mod # NIL THEN
  452.                         t.base := mod.SB;
  453.                         RTDD.GetScope (w, t, t.syms, t.base, 0)
  454.                     ELSE Texts.WriteString (w, "Module not loadable")
  455.                     END
  456.                 ELSE                                                        (* local scope *)
  457.                     p := RTDT.procs;
  458.                     WHILE (p # NIL) & (p.regs # t.regs) DO p := p.up END;
  459.                     IF p # NIL THEN RTDD.GetLocalScope (w, t, t.syms, t.regs, 0)
  460.                     ELSE Texts.WriteString (w, "Old View")
  461.                     END
  462.                 END;
  463.                 org := f.org;
  464.                 Texts.Delete (t, 0, t.len);
  465.                 Texts.Append (t, w.buf);
  466.                 TextFrames.Show (f, org)
  467.             ELSE PrevDataHandle (f, msg) END
  468.         ELSE PrevDataHandle (f, msg) END
  469. END DataHandle;
  470. PROCEDURE PCHandler;
  471. PROCEDURE PCOffHandler;
  472. PROCEDURE NewText (syms: RTDC.Sym; base: LONGINT; regs: Sys.ExceptionInfo; VAR modName: ARRAY OF CHAR) : Text;
  473. PROCEDURE DataHandler;
  474. PROCEDURE StepInto*;
  475. PROCEDURE Step*;
  476. PROCEDURE Return*;
  477. PROCEDURE Run*;
  478. PROCEDURE PostMortem*;
  479. PROCEDURE Close*;
  480. BEGIN
  481.     lastPos := 0; lastBeginPC := 0;
  482.     RTDB.CleanUp;
  483.     RTDT.Stop
  484. END Close;
  485. PROCEDURE Trace*;
  486. VAR s: Texts.Scanner;
  487. BEGIN
  488.     IF RTDT.Debugging () OR RTDT.Launching () THEN Close END;
  489.     GetArg (s); RTDB.AddModules (s);
  490.     RTDT.Install; RTDT.Prepare;
  491.     RTDB.EntryAll
  492. END Trace;
  493. PROCEDURE ShowModules*;
  494. PROCEDURE Stack*;
  495. PROCEDURE Source*;
  496. PROCEDURE Breakpoint*;
  497. PROCEDURE Data*;
  498. PROCEDURE InitIcon;
  499. BEGIN
  500. END Debug.
  501. PROCEDURE Start*;
  502. PROCEDURE Stop*;
  503.